package com.it.job;

import lombok.extern.slf4j.Slf4j;
import org.quartz.*;

import java.time.LocalDateTime;

/**
 * @author 汤北寒
 */
@Slf4j
@PersistJobDataAfterExecution
@DisallowConcurrentExecution
public class AsyncJob implements Job {
    @Override
    public void execute(JobExecutionContext context) {
        log.info(" --- 同步任务调度开始 --- ");
        try {
            //此处模拟任务执行时间 5秒  任务表达式配置为每秒执行一次：0/1 * * * * ? *
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        //测试发现 每5秒执行一次
        log.info(" --- 执行完毕，时间：" + LocalDateTime.now() + "---");
    }
}
